﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
namespace SQT.tracnghiem.Ajax.ASP
{
    public partial class edit_info : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string name = Request.QueryString["name"];
            string email = Request.QueryString["email"];
            string birthday = Request.QueryString["birthday"];
            string phone = Request.QueryString["phone"];
            string city = Request.QueryString["city"];
            int? add = null;
            int sex = int.Parse(Request.QueryString["sex"]);

            bool check_sex = true;
            if (sex == 0)
                check_sex = false;
            if (city != "")
            {
                add = int.Parse(city);
            }
            int id = int.Parse(Session["user_id"].ToString());

            var get_user = new TblUserController().FetchAll().Where(x => x.UserId == id).Single();

            new TblUserController().Update(id, get_user.NumberStudy, get_user.UserName, get_user.UserPass, name, DateTime.Parse(birthday), phone, get_user.Avatar, email, get_user.AddressMail,add, get_user.Facebook, check_sex, get_user.UserLevel,get_user.ClassX, get_user.Active, get_user.SignInDate, get_user.Wallpaper, get_user.Note);
        }
    }
}